/*--------------------------------*- C++ -*----------------------------------*\
| =========                 |                                                 |
| \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
|  \\    /   O peration     | Version:  2.0.0                                 |
|   \\  /    A nd           | Web:      www.OpenFOAM.com                      |
|    \\/     M anipulation  |                                                 |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version     2.0;
    format      ascii;
    class       dictionary;
    object      snappyHexMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

// Which of the steps to run
castellatedMesh true;
snap            true;
addLayers       true;


geometry
{
    sphere1
    {
        type searchableSphere;
        centre  (0.5 0.5 0.4875);
        radius  0.00625;
    }
    sphere2
    {
        type searchableSphere;
        centre  (0.5 0.5 0.5125);
        radius  0.00625;
    }
};

castellatedMeshControls
{
    maxLocalCells 1000000;
    maxGlobalCells 2000000;
    minRefinementCells 0;
    maxLoadUnbalance 0.10;
    nCellsBetweenLevels 1;
    features
    (
    );
    refinementSurfaces
    {  
        sphere1
        {
            level (1 1);
        /*    regions
            {
                secondSolid
                {
                    level (5 5);
                }
            }
        */
            patchInfo
            {
                type wall;
            }
        } 
        sphere2
        {
            level (1 1);
        /*    regions
            {
                secondSolid
                {
                    level (5 5);
                }
            }
        */
            patchInfo
            {
                type wall;
            }
        }     
    }

    resolveFeatureAngle 30;
    refinementRegions
    {
	sphere1
	{
		mode inside;
		levels ((1.0 1));
	}
	sphere2
	{
		mode inside;
		levels ((1.0 1));
	}
    }
//    locationInMesh (0.5 0.5 1.2);
//    locationInMesh (0.5 0.5 0.5);
    locationInMesh 
    ( 
        0.5 0.5 0.01
    ); 
    allowFreeStandingZoneFaces true;
}


snapControls
{
    nSmoothPatch 3;
    tolerance 1.0;
    nSolveIter 30;
    nRelaxIter 3;
}

addLayersControls
{
    relativeSizes true;
    layers
    {
        sphere1
        {
            nSurfaceLayers 1;
        }
        sphere2
        {
            nSurfaceLayers 1;
        }
    }

    expansionRatio 1.0;
//    finalLayerThickness 1e-9;
finalLayerThickness 1e-6;
    finalLayerRatio 0.01;
    minThickness 1e-6;
    nGrow 1;
    featureAngle 60;
    nRelaxIter 5;
    nSmoothSurfaceNormals 1;
    nSmoothNormals 3;
    nSmoothThickness 10;
    maxFaceThicknessRatio 0.5;
    maxThicknessToMedialRatio 0.3;
    minMedianAxisAngle 90;
    nBufferCellsNoExtrude 0;
    nLayerIter 50;
    nRelaxedIter 20;
}

meshQualityControls
{
    maxNonOrtho 65;
    maxBoundarySkewness 20;
    maxInternalSkewness 4;
    maxConcave 80;
    minVol 1e-200;
    minTetQuality 1e-9;
    minArea -1;
    minTwist 0.05;
    minDeterminant 0.001;
    minFaceWeight 0.05;
    minVolRatio 0.00001;
    minTriangleTwist -1;

    nSmoothScale 4;
    errorReduction 0.75;

    relaxed
    {
        maxNonOrtho 75;
    }
}

debug 0;
mergeTolerance 1e-6;

// ************************************************************************* //
